/*
 * Copyright 2008 Google Inc. All Rights Reserved.
 * Author: fraser@google.com (Neil Fraser)
 * Author: anteru@developer.shelter13.net (Matthaeus G. Chajdas)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Difference Match and Patch
 * http://code.google.com/p/google-diff-match-patch/
 */
/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 **/
using System.Collections.Generic;

namespace Peter.Logic.DiffEngine
{
   /// <summary>
   /// Javascript compatibility extensions.
   /// </summary>
   internal static class CompatibilityExtensions
   {
      /// <summary>
      /// JavaScript splice function.
      /// </summary>
      public static List<T> Splice<T> (this List<T> input, int start, int count,
                                       params T[] objects)
      {
         List<T> deletedRange = input.GetRange (start, count);
         input.RemoveRange (start, count);
         input.InsertRange (start, objects);

         return deletedRange;
      }

      /// <summary>
      /// JavaScript substring function.
      /// </summary>
      public static string JavaSubstring (this string s, int begin, int end)
      {
         return s.Substring (begin, end - begin);
      }
   }
}